package mylibrary.thread.test;

import java.io.IOException;
import java.net.ServerSocket;

public class MyThread extends Thread{
	
	ServerSocket serverSocket = null;

//	public int x = 0;
	
//	public void run() {
//		System.out.println(x++);
//	}
	
	public void init() {
		try {
			serverSocket = new ServerSocket(100);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public void run() {
		
		while(true) {
			
			try {
				
				System.out.println("1111111111111");
				serverSocket.accept();
				System.out.println("2222222222222");
				
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] args) {
		
		MyThread thread = new MyThread();
		thread.init();
		thread.start();
	}
	
}
